package com.xopencode.string;

import org.apache.commons.lang3.StringUtils;

/**
 * @Auther: Mcb
 * @Date: 2021/6/9 13:52
 * @Description:
 */
public class StringUtil {

    public static void main(String[] args) {
        String x = new String("ab");
        x=change(x);
        System.out.println("main "+x);
    }

    public static String change(String s) {
        s = "cd";
        System.out.println(s);
        return s;
    }



    /**
     * 属性名格式转换为驼峰格式
     * @param columnName 属性名
     * @return
     */
    public static String nameHump(String columnName){
        if(StringUtils.isEmpty(columnName)){
            return "";
        }
        StringBuilder columnName2 = new StringBuilder(columnName.toLowerCase());
        int index = 0;
        if (columnName2.indexOf("_", index) != -1) {
            while ((index = columnName2.indexOf("_", index)) != -1) {
                columnName2.replace(index, index + 1, "");
                columnName2.replace(index, index + 1, String.valueOf(columnName2.charAt(index)).toUpperCase());
                index++;
            }
        }
        return columnName2.toString();
    }
}
